Add GitHub App authentication support - #154
Merged
Merged
Conversation
Add app_id and private_key fields to Source struct. Refactor GitHubClient to use hasAuth/tokenFunc instead of raw accessToken string, enabling both PAT and GitHub App auth. Auto-discovers installation ID via Apps.FindRepositoryInstallation.
Tests cover: - Conflicting auth configuration (token + app creds) - Incomplete app credentials (app_id without private_key and vice versa) - Successful installation discovery and token-authenticated GraphQL - Installation not found (404) - Invalid private key
Concourse credential managers interpolate all values as strings. Use a FlexInt64 type that unmarshals from both JSON numbers and quoted numeric strings.
- Extract normalizeURL helper to remove 3x duplicated URL normalization in appInstallationClient - Return error instead of silently ignoring url.Parse failure - Add tests for FlexInt64 unmarshaling from JSON string (the actual credential-manager scenario that broke in production)
databus23
force-pushed
the
wip/github-app-auth
branch
from
July 3, 2026 21:51
2af0dc5 to
571adb7
Compare
Member
|
Thanks for the PR! I'll review it this week. |
taylorsilva
approved these changes
Jul 24, 2026
taylorsilva
left a comment
Member
There was a problem hiding this comment.
LGTM - I want to bump go-github to v88 to match the new dependency and just for the sake of staying closer to the latest version. I'll do that in another PR. There are some other minor nits as well but I'll fix those in my PR.
I have not manually tested this with a github app. I am trusting that you have.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Some organizations forbid the use of personal access tokens, which makes this resource unusable in those environments. This PR adds GitHub App authentication as an alternative to personal access tokens.
Changes
Adds
app_idandprivate_keyas source configuration options. When provided, the resource authenticates as a GitHub App installation:owner/repositoryExample configuration
Notes
app_idaccepts both numeric and string values (credential managers like Vault/CredHub interpolate everything as strings)access_token- providing both is a validation erroraccess_tokenFixes #124